<?php if (isset($this->categories) && $this->categories) : ?>
<?php foreach ($this->categories as $index => $category) : ?>
<?php if ($category['parent_id'] == 0 && count($category['latest_articles']) > 0) : ?>
<div class="ninhgio latest_home_<?php echo $this->uuid; ?>">
    <div class="boxShareClunmleft500">
		<div class="boxShareClunmleft500Top">
			<div class="boxShareClunmleft500Btom">   
		        <div class="sortHomeTitle">
		            <div class="boxTabMnuShare">               
		                <a class="txt_16_bold fl category_item" rel="<?php echo $category['category_id']; ?>" title="<?php echo $this->STRING->escape($category['name']); ?>" href="javascript: void(0);"><?php echo $category['name']; ?></a>
		                <?php if ($category['sub_categories'] && ($numSubCategories = count($category['sub_categories'])) > 0) : ?>
		                <?php foreach ($category['sub_categories'] as $subIndex => $subCategory) : ?>
			            <a class="txt_12 fr category_item" rel="<?php echo $subCategory['category_id']; ?>" href="javascript: void(0);" title="<?php echo $this->STRING->escape($subCategory['name']); ?>"><?php echo $subCategory['name']; ?></a>
			            <?php if ($subIndex < $numSubCategories - 1) : ?>
			            <span class="txt_space">|</span>
			            <?php endif; ?>
			            <?php endforeach; ?>
			            <?php endif; ?>
		                <div class="clear"></div>
		            </div>
		        </div>
		        <div class="clear">
					<div class="boxContentOderShare latest_home_content_<?php echo $this->uuid; ?>">
					<?php foreach ($category['latest_articles'] as $articleIndex => $article) : ?>
					<?php if ($articleIndex == 0) : ?> 
						<?php if (isset($article['image_url']) && $article['image_url']) : ?> 
						<div class="fl" style="width: 100px; margin: 0pt 8px 2px 0pt;"> 
			     			<a href="<?php echo $this->url('news_article_details', $article); ?>" target="_self">
			     				<img style="width: 100px; border: 1px solid #EFEDEE" src="<?php echo $article['image_url']; ?>" alt="" />  
			     			</a> 
			     		</div>
		     			<?php else : ?>
		     				<?php if (isset($article['image_general']) && $article['image_general']) : ?>
				            <div class="fl" style="width: 100px;overflow: hidden; margin: 0pt 8px 2px 0pt;"> 
					            <a href="<?php echo $this->url('news_article_details', $article); ?>" target="_self">  
			     					<img style="width: 100px; border: 1px solid #EFEDEE;" src="<?php echo $this->APP_RESOURCE_SERVER; ?><?php echo $article['image_general']; ?>" alt="" />  
			     				</a>
			     			</div>
				            <?php endif; ?>
			            <?php endif; ?>
		    			<div class="paddingbt4 fontsize13 bold">
		    				<a class="color3" href="<?php echo $this->url('news_article_details', $article); ?>" target="_self"><?php echo $article['title']; ?></a>
		    			</div>
		    			<div class="tal"><?php echo $this->STRING->subString($article['description'], 30); ?></div>
			    		<div class="clear pdt5">
			    	<?php else : ?> 
			                <div class="ItemSubCS">             
								<a class="fontsize12 color5" href="<?php echo $this->url('news_article_details', $article); ?>" target="_self"><?php echo $article['title']; ?></a>
			                </div>
					<?php endif; ?>
			        <?php endforeach; ?>           
			    		</div>  
			    		<div class="xemtiep clear">                
			        		<a class="fontsize12 color2" style="padding-left: 13px; float: left; line-height: 23px;" href="<?php echo $this->url('news_article_category', $category); ?>" target="_self"><?php echo $this->TRANSLATOR->widget('see_details'); ?></a>
			        		<a href="<?php echo $this->url('news_rss_category', $category); ?>" target="_blank" class="fontsize12 color11" style="font-weight: bold; float: left; line-height: 23px; padding-left: 3px;"><?php echo $this->TRANSLATOR->widget('rss'); ?></a>
			    		</div>
			    		<div class="clear"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>	
<?php endif; ?>
<?php endforeach; ?>
<script type="text/javascript">
$(document).ready(function() {
	$('.latest_home_<?php echo $this->uuid; ?>').each(function() {
		var self = this;
		var contentContainer = $(self).find('.latest_home_content_<?php echo $this->uuid; ?>:first');
		$(self).find('a.category_item').each(function() {
			$(this).bind('click', function() {
				var categoryId = $(this).attr('rel');
				$(self).find('a.txt_16_bold').removeClass('txt_16_bold').addClass('txt_12');
				$(this).removeClass('txt_12').addClass('txt_16_bold'); 

				var params = 'category_id=' + categoryId + '|limit=<?php echo $this->limit; ?>';
				Gio.Core.Widget.Loader.baseUrl = '<?php echo $this->url('core_widget_ajax'); ?>';
				Gio.Core.Widget.Loader.cacheEnable = '<?php if ($this->cacheEnable) : ?>true<?php else : ?>false<?php endif; ?>';
				Gio.Core.Widget.Loader.cacheTimeout = '<?php if ($this->cacheTimeout) : ?><?php echo $this->cacheTimeout; ?><?php else : ?>false<?php endif; ?>';
				Gio.Core.Widget.Loader.queueAction('news', 'latesthome', 'get', params, contentContainer, '');
			});
		});
	});
});
</script>
<?php endif; ?>